import { createApp } from "vue";
import App from "./App.vue";
import router from "./router";
import api from './api'
// 创建app对象
const app = createApp(App);
//在实例上绑定页面
app.config.globalProperties.$api = api

//路由守卫
router.beforeEach((to, from) => {
    if(to.path == '/login'){
        return true
    }else{
        if(!localStorage.getItem('h5_token')){
            return '/login'
        }
    }
})
// 引用路由
app.use(router);
// 创建挂载
app.mount("#app");

